package com.tjsinfo.tjsoa.address.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.address.common.TAddresslistCommon;
import com.tjsinfo.tjsoa.address.common.TAddresslistCommonDao;
import com.tjsinfo.tjsoa.address.common.TAddresslistCommonManager;

public class CommonDeleteAction extends Action {
	
    TAddresslistCommonManager addresslistCommonManager;
    TAddresslistCommonDao addresslistCommonDao;
    
	public TAddresslistCommonManager getAddresslistCommonManager() {
		return addresslistCommonManager;
	}

	public void setAddresslistCommonManager(
			TAddresslistCommonManager addresslistCommonManager) {
		this.addresslistCommonManager = addresslistCommonManager;
	}
	
	public TAddresslistCommonDao getAddresslistCommonDao() {
		return addresslistCommonDao;
	}

	public void setAddresslistCommonDao(TAddresslistCommonDao addresslistCommonDao) {
		this.addresslistCommonDao = addresslistCommonDao;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		try {
			String id=request.getParameter("id");
			TAddresslistCommon ins=addresslistCommonManager.findById(Integer.valueOf(id));
			addresslistCommonDao.delete(ins);

			return mapping.findForward("success");
		}catch (Exception e) {
			return mapping.findForward("failure");
		}
	}
}

